home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / graphics / pstex / args.h < prev    next >
C/C++ Source or Header  |  1992-01-27  |  3KB  |  125 lines

  1. /*
  2.  * Argument parsing utilies.
  3.  *
  4.  * Neil Hunt (Neil%Teleos.com@ai.sri.com).
  5.  *
  6.  * Copyright (c) 1989 Teleos Research, Inc 1989.
  7.  * Copyright (c) 1988 Schlumberger Technologies, Inc 1988.
  8.  *
  9.  * Anyone can use this software in any manner they choose,
  10.  * including modification and redistribution, provided they make
  11.  * no charge for it, and these conditions remain unchanged.
  12.  *
  13.  * This program is distributed as is, with all faults (if any), and
  14.  * without any wrranty.  No author or distributor accepts responsibility
  15.  * to anyone for the consequences of using it, or for whether it serves any
  16.  * particular purpose at all, or any other reason.
  17.  *
  18.  * $Log:    args.h,v $
  19.  * Revision 1.1  89/02/10  18:41:34  neil
  20.  * Initial revision
  21.  * 
  22.  * Taken from newlib library:
  23.  * Revision 1.4  88/05/11  16:46:49  hunt
  24.  * Added a_getc and a_ungetc.
  25.  * 
  26.  * Revision 1.3  88/03/17  18:31:19  hunt
  27.  * Added a_scaled function and some scale tables.
  28.  * 
  29.  * Revision 1.2  88/01/12  18:42:09  hunt
  30.  * Added a_arg(argc, argv) function for completeness and to hide a_arg_ptr.
  31.  * Currently a_arg_ptr is not made static, so as not to break old code.
  32.  * 
  33.  * Revision 1.1  87/11/24  11:27:40  hunt
  34.  * Initial revision
  35.  */
  36.  
  37. #define A_ARG    (-1)
  38. #define A_END    0
  39.  
  40. /*
  41.  * a_prog_name holds the program name (argv[0]) after starting. 
  42.  */
  43.  
  44. extern char *    a_prog_name;
  45.  
  46. /*
  47.  * a_next:
  48.  *    Called with argc, argv, returns one of the following:
  49.  *        The next flag to be processed.
  50.  *        A_ARG indicating a filename etc.
  51.  *        A_END indicating the end of the args.
  52.  */
  53.  
  54. extern char    a_next();
  55.  
  56. /*
  57.  * a_getc:
  58.  *    Returns the next char in the current word,
  59.  *    or '\0' if no more chars in word.
  60.  */
  61.  
  62. extern char    a_getc();
  63.  
  64. /*
  65.  * a_ungetc:
  66.  *    Pushes char back onto current word, if still available.
  67.  */
  68.  
  69. extern void    a_ungetc();
  70.  
  71. /*
  72.  * a_arg:
  73.  *    Called with argc, argv; returns the next word or part word.
  74.  */
  75.  
  76. extern char    *a_arg();
  77.  
  78. /*
  79.  * a_number:
  80.  *      Called with argc, argv, interprets the next word or part word
  81.  *    as a number (double precision).
  82.  *    In case there is a missing parameter, 0.0 is returned.
  83.  */
  84.  
  85. double        a_number();
  86.  
  87. /*
  88.  * a_integer:
  89.  *      Called with argc, argv, interprets the next word or part word
  90.  *    as an integer.
  91.  *    In case there is a missing parameter, 0 is returned.
  92.  */
  93.  
  94. int        a_integer();
  95.  
  96. /*
  97.  * scale_table:
  98.  *    List of scale names and factors.
  99.  */
  100.  
  101. struct scale_table
  102. {
  103.     char    *scale_name;
  104.     double    scale_factor;
  105. };
  106.  
  107. extern struct scale_table scale_units[];
  108.  
  109. extern struct scale_table scale_inches[];
  110. extern struct scale_table scale_meters[];
  111.  
  112. extern struct scale_table scale_seconds[];
  113.  
  114. extern struct scale_table scale_kilograms[];
  115. extern struct scale_table scale_pounds[];
  116.  
  117. /*
  118.  * a_scaled:
  119.  *      Called with argc, argv, interprets the next word or part word
  120.  *    as an integer with a units specifier.
  121.  *    In case there is a missing parameter, 0 is returned.
  122.  */
  123.  
  124. double        a_scaled();
  125.